package com.dev.springBootDemo.generics;

/**
 * 测试泛型
 * @author zhumq
 * @date 2024/7/7 12:56
 */
public class TestGenerics {
    public static void main(String[] args) {
        Student<String> student = new Student<>();
        student.setT("zhumq");
        System.out.println(student.getT()); // zhumq

        Student<Integer> student1 = new Student<>();
        student1.setT(1);
        System.out.println(student1.getT()); // 1

        Student<Double> student2 = new Student<>();
        student2.setT(1.0);
        System.out.println(student2.getT()); // 1.0

        Student student3 = new Student<>(); // 没有指定类型，默认为Object，注意类型转化
    }
}
